<script setup>
	import { ref } from 'vue'
	// 2024-08-19 17：30
	const arr = [1, 2, 3]
	arr.forEach(item => {
		console.log(item);
	})
	
	const obj = { a:1, b:2, c:3}
	Object.keys(obj).forEach((key, value) => {
		console.log(key, value);
	})
	
	// 2024-8-19 17:33
	const promise = new Promise((resolve, reject) => {
	  if (1) {
	    resolve();//成功结果
	  } else {
	    reject(); // 失败原因
	  }
	})
	promise.then().catch()
	
	const wait = async () => {
		const res = await axios.get('...')
		console.log(res); // 等到await之后执行
	}
	
	const arr1 = [
	  { XM: '张三', KC: '语文', FS: 81 },
	  { XM: '张三', KC: '数学', FS: 75 },
	  { XM: '李四', KC: '语文', FS: 76 },
	  { XM: '李四', KC: '数学', FS: 90 },
	  { XM: '王五', KC: '语文', FS: 81 },
	  { XM: '王五', KC: '数学', FS: 100 },
	  { XM: '王五', KC: '英语', FS: 90 }
	];
	
	localStorage.setItem('T', JSON.stringify(arr1)) // 存储
	let getData = localStorage.getItem('T') // 获取
	getData = JSON.parse(getData) || []
	
	const data = ref(getData)
</script>

<template>
	<table>
	  <thead>
		<tr>
		  <th>XM</th>
		  <th>KC</th>
		  <th>FS</th>
		</tr>
	  </thead>
	  <tbody>
		<tr v-for="item in data" :key="item.XM + item.KC">
		  <td>{{ item.XM }}</td>
		  <td>{{ item.KC }}</td>
		  <td>{{ item.FS }}</td>
		</tr>
	  </tbody>
	</table>
</template>